#ifndef OPERATION_H
#define OPERATION_H

#include <QAbstractListModel>
#include <QObject>

class Operation : public QAbstractListModel
{
    Q_OBJECT
public:
    explicit Operation(QObject *parent = nullptr);
    // Q_PROPERTY(QString batchNo READ batchNo WRITE setBatchNo  NOTIFY signalBatchNoChanged)
    // Q_INVOKABLE bool addBatch(QString product, QString workShop);
    // Q_INVOKABLE bool updateBatch(QString desc);
    // Q_INVOKABLE QVariantMap get(int row) const;
       Q_INVOKABLE bool loadOperation(const QString& filter);
       Q_INVOKABLE bool insertOperationLog(const QString &type, const QString &desc, const QString keyInfo);

public:
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    QHash<int, QByteArray> roleNames() const override;

// signals:
//     void signalBatchNoChanged();
public:
//     QString batchNo();
//     void setBatchNo(QString batchNo);

private:
    QHash<int, QByteArray> m_roles;
    QList<QHash<QString,QVariant>> m_records;

// private:
//     QString m_batchNo;
//     QString m_product;
//     QString m_workShop;
};

#endif // OPERATION_H
